var $dialog = null;
var $pleasewaitDialog = null;

function showPleaseWait() {
  $pleasewaitDialog = $('<div></div>')
  .html("Please wait..")
  .dialog({
    autoOpen: false,
    title: "Processing",
    resizable: false,
    closeOnEscape: false,
    modal: true,
    height: 150
  });
  $pleasewaitDialog.dialog('open');
  return false;	// prevent the default action, e.g., following a link
}

function showDialog(title, html, buttons) {
  if(!buttons) buttons = { Close: function() { $(this).dialog('close'); } };
  $dialog = $('<div></div>')
  .html(html)
  .dialog({
    autoOpen: false,
    title: title,
    buttons: buttons,
    resizable: false,
    closeOnEscape: false,
    modal: true,
    //height: 150
  });
  $dialog.dialog('open');
  return false;	// prevent the default action, e.g., following a link
}

function getCheckedQstring(elementName) {
  var result = { count: 0, querystring: "" };
  $("input[name='" + elementName + "']").each(function() {
    if(this.checked == true) {
      result.count += 1;
      result.querystring += "&" + elementName + "=" + $(this).val();
    }
  });
  return result;
}
